/*
 * Cherry programming language
 * Copyright (C) 2013 Christoph Mueller
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <stdint.h>

#define TRUE 1
#define FALSE 0

typedef void*       cy_pointer_t;
typedef void*       cy_const_pointer_t;

typedef uint8_t     cy_byte_t;
typedef uint16_t    cy_word_t;
typedef uint32_t    cy_double_t;
typedef uint64_t    cy_quad_t;

typedef int64_t     cy_fixnum_t;
typedef double      cy_float_t;
typedef char        cy_boolean_t;
typedef uint32_t    cy_unicode_t;


enum org_cherry_value_type {
	CY_BOOLEAN,
	CY_FIXNUM,
	CY_FLOAT,
	CY_STRING, 
	CY_CHAR,
    CY_PAIR
};


struct org_cherry_meta {
  enum org_cherry_value_type type;
};


struct org_cherry_value {
    struct org_cherry_meta meta;

	union {
		cy_boolean_t boolean_value;

		cy_fixnum_t fixnum_value;

		cy_float_t float_value;

		cy_byte_t* string_value;
		cy_unicode_t char_value;
	};
};


struct org_cherry_pair {
  struct org_cherry_meta meta;

  struct org_cherry_value* head;
  struct org_cherry_value* tail;
};

struct org_cherry_value* 	__org_cherry_make_fixnum(cy_fixnum_t value);
struct org_cherry_value* 	__org_cherry_make_float(cy_float_t float_value);
struct org_cherry_value* 	__org_cherry_make_string(cy_byte_t* string_value);
struct org_cherry_value* 	__org_cherry_make_char(cy_unicode_t char_value);

struct org_cherry_pair*     __org_cherry_list_cons(struct org_cherry_value* head, struct org_cherry_value* tail);

struct org_cherry_value*    __org_cherry_list_head(struct org_cherry_pair* pair);
struct org_cherry_value*    __org_cherry_list_tail(struct org_cherry_pair* pair);
struct org_cherry_value*    __org_cherry_list_length(struct org_cherry_pair* pair);

struct org_cherry_value*    __org_cherry_primitive_add(struct org_cherry_pair* pair);





